Fix zooming images in SHR
authorJim Porter <jporterbugs@gmail.com>
Thu, 20 Jun 2024 03:59:59 +0000 (20:59 -0700)
committerJim Porter <jporterbugs@gmail.com>
Sun, 23 Jun 2024 06:09:00 +0000 (23:09 -0700)
commit5f9b5803bea0f360a91e00cd85d72ea7f56d6095
treef54e14a1871a2fd5c5f276f299058e4a78749f4a
parent6f2036243f24369b0b4c35c9b323eb19dad4e4cd
Fix zooming images in SHR

Previously, for images with no alt-text, the zoomed image wouldn't get
properly inserted.  For images with alt-text, both the zoomed and
unzoomed image would be displayed at once (bug#71666).

* lisp/net/shr.el (shr-sliced-image): New face.
(shr-zoom-image): Reimplement using
'next/previous-single-property-change', and don't bother deleting any of
the text.
(shr-image-fetched): Clean up any overlays when deleting the old region.
(shr-put-image): Ensure we always have a non-empty string to put the
image on.  For sliced images, just use "*", since we'll repeat it, so we
can't preserve the original buffer text exactly anyway.  Apply an
overlay to sliced images to prevent unsightly text decorations.
(shr-tag-img): Move the placeholder space insertion where it should be
and explain what it's doing.

* test/lisp/net/shr-tests.el (shr-test--max-wait-time)
(shr-test-wait-for): New helper functions.
(shr-test/zoom-image): New test.
lisp/net/shr.el
test/lisp/net/shr-tests.el